<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>rrdxport</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>

<body>



<h1 id="NAME">NAME</h1>

<p>rrdxport - Export data in XML format based on data from one or several RRD</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<p><b>rrdtool</b> <b>xport</b> <span style="white-space: nowrap;">[<b>-s</b>|<b>--start</b> <i>seconds</i>]</span> <span style="white-space: nowrap;">[<b>-e</b>|<b>--end</b> <i>seconds</i>]</span> <span style="white-space: nowrap;">[<b>-m</b>|<b>--maxrows</b> <i>rows</i>]</span> <span style="white-space: nowrap;">[<b>--step</b> <i>value</i>]</span> <span style="white-space: nowrap;">[<b>--json</b>]</span> <span style="white-space: nowrap;">[<b>-t</b>|<b>--showtime</b>]</span> <span style="white-space: nowrap;">[<b>--enumds</b>]</span> <span style="white-space: nowrap;">[<b>--daemon</b>|<b>-d</b> <i>address</i>]</span> <span style="white-space: nowrap;">[<b>DEF:</b><i>vname</i><b>=</b><i>rrd</i><b>:</b><i>ds-name</i><b>:</b><i>CF</i>]</span> <span style="white-space: nowrap;">[<b>CDEF:</b><i>vname</i><b>=</b><i>rpn-expression</i>]</span> <span style="white-space: nowrap;">[<b>XPORT</b><b>:</b><i>vname</i>[<b>:</b><i>legend</i>]]</span></p>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p>The <b>xport</b> function&#39;s main purpose is to write an XML formatted representation of the data stored in one or several <b>RRD</b>s. It can also extract numerical reports.</p>

<p>If no <i>XPORT</i> statements are found, there will be no output.</p>

<dl>

<dt id="s---start-seconds-default-end-1day"><b>-s</b>|<b>--start</b> <i>seconds</i> (default end-1day)</dt>
<dd>

<p>The time when the exported range should begin. Time in seconds since epoch (1970-01-01) is required. Negative numbers are relative to the current time. By default one day worth of data will be printed. See also <a href="./rrdfetch.html#AT-STYLE-TIME-SPECIFICATION">&quot;AT-STYLE TIME SPECIFICATION&quot; in rrdfetch</a> for a detailed explanation on how to specify time.</p>

<p>See <a href="#OUTPUT-FORMAT">&quot;OUTPUT FORMAT&quot;</a> below for details on how this affects the output.</p>

</dd>
<dt id="e---end-seconds-default-now"><b>-e</b>|<b>--end</b> <i>seconds</i> (default now)</dt>
<dd>

<p>The time when the exported range should end. Time in seconds since epoch. See also <a href="./rrdfetch.html#AT-STYLE-TIME-SPECIFICATION">&quot;AT-STYLE TIME SPECIFICATION&quot; in rrdfetch</a> for a detailed explanation on how to specify time.</p>

<p>See <a href="#OUTPUT-FORMAT">&quot;OUTPUT FORMAT&quot;</a> below for details on how this affects the output.</p>

</dd>
<dt id="m---maxrows-rows-default-400-rows"><b>-m</b>|<b>--maxrows</b> <i>rows</i> (default 400 rows)</dt>
<dd>

<p>This works like the <b>-w</b>|<b>--width</b> parameter of <i>rrdgraph</i>. In fact it is exactly the same, but the parameter was renamed to describe its purpose in this module. See <i>rrdgraph</i> documentation for details.</p>

</dd>
<dt id="step-value-default-automatic"><b>--step</b> <i>value</i> (default automatic)</dt>
<dd>

<p>See <a href="./rrdgraph.html">rrdgraph</a> documentation.</p>

</dd>
<dt id="daemon--d-address"><b>--daemon</b>|<b>-d</b> <i>address</i></dt>
<dd>

<p>Address of the <a href="./rrdcached.html">rrdcached</a> daemon. If specified, a <code>flush</code> command is sent to the server before reading the RRD files. This allows <b>rrdtool</b> to return fresh data even if the daemon is configured to cache values for a long time. For a list of accepted formats, see the <b>-l</b> option in the <a href="./rrdcached.html">rrdcached</a> manual.</p>

<pre><code>  rrdtool xport --daemon unix:/var/run/rrdcached.sock ...</code></pre>

</dd>
<dt id="t---showtime"><b>-t</b>|<b>--showtime</b></dt>
<dd>

<p>include the time into each data row.</p>

</dd>
<dt id="json"><b>--json</b></dt>
<dd>

<p>produce json formatted output (instead of xml)</p>

</dd>
<dt id="enumds"><b>--enumds</b></dt>
<dd>

<p>The generated xml should contain the data values in enumerated tags.</p>

<pre><code> &lt;v0&gt;val&lt;/v0&gt;&lt;v1&gt;val&lt;/v1&gt;</code></pre>

</dd>
<dt id="DEF:vname-rrd:ds-name:CF"><b>DEF:</b><i>vname</i><b>=</b><i>rrd</i><b>:</b><i>ds-name</i><b>:</b><i>CF</i></dt>
<dd>

<p>See <i>rrdgraph</i> documentation.</p>

</dd>
<dt id="CDEF:vname-rpn-expression"><b>CDEF:</b><i>vname</i><b>=</b><i>rpn-expression</i></dt>
<dd>

<p>See <i>rrdgraph</i> documentation.</p>

</dd>
<dt id="XPORT:vname-:legend"><b>XPORT:</b><i>vname</i>[<b>:</b><i>legend</i>]</dt>
<dd>

<p>At least one <i>XPORT</i> statement should be present. The values referenced by <i>vname</i> are printed. Optionally add a legend.</p>

</dd>
</dl>

<h1 id="OUTPUT-FORMAT">OUTPUT FORMAT</h1>

<p>The output is enclosed in an <b>xport</b> element and contains two blocks. The first block is enclosed by a <b>meta</b> element and contains some meta data. The second block is enclosed by a <b>data</b> element and contains the data rows.</p>

<p>Let&#39;s assume that the <i>xport</i> command looks like this:</p>

<pre><code>  rrdtool xport \
          --start now-1h --end now \
          DEF:xx=host-inout.lo.rrd:output:AVERAGE \
          DEF:yy=host-inout.lo.rrd:input:AVERAGE \
          CDEF:aa=xx,yy,+,8,* \
          XPORT:xx:&quot;out bytes&quot; \
          XPORT:aa:&quot;in and out bits&quot;</code></pre>

<p>The resulting meta data section is (the values will depend on the RRD characteristics):</p>

<pre><code>  &lt;meta&gt;
    &lt;start&gt;1020611700&lt;/start&gt;
    &lt;step&gt;300&lt;/step&gt;
    &lt;end&gt;1020615600&lt;/end&gt;
    &lt;rows&gt;14&lt;/rows&gt;
    &lt;columns&gt;2&lt;/columns&gt;
    &lt;legend&gt;
      &lt;entry&gt;out bytes&lt;/entry&gt;
      &lt;entry&gt;in and out bits&lt;/entry&gt;
    &lt;/legend&gt;
  &lt;/meta&gt;</code></pre>

<p>The resulting data section is:</p>

<pre><code>  &lt;data&gt;
    &lt;row&gt;&lt;t&gt;1020611700&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;
    &lt;row&gt;&lt;t&gt;1020612000&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;
    &lt;row&gt;&lt;t&gt;1020612300&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;
    &lt;row&gt;&lt;t&gt;1020612600&lt;/t&gt;&lt;v&gt;3.4113333333e+00&lt;/v&gt;&lt;v&gt;5.4581333333e+01&lt;/v&gt;&lt;/row&gt;
    &lt;row&gt;&lt;t&gt;1020612900&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;
    &lt;row&gt;&lt;t&gt;1020613200&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;
    &lt;row&gt;&lt;t&gt;1020613500&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;
    &lt;row&gt;&lt;t&gt;1020613800&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;
    &lt;row&gt;&lt;t&gt;1020614100&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;
    &lt;row&gt;&lt;t&gt;1020614400&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;
    &lt;row&gt;&lt;t&gt;1020614700&lt;/t&gt;&lt;v&gt;3.7333333333e+00&lt;/v&gt;&lt;v&gt;5.9733333333e+01&lt;/v&gt;&lt;/row&gt;
    &lt;row&gt;&lt;t&gt;1020615000&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;
    &lt;row&gt;&lt;t&gt;1020615300&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;
    &lt;row&gt;&lt;t&gt;1020615600&lt;/t&gt;&lt;v&gt;NaN&lt;/v&gt;&lt;v&gt;NaN&lt;/v&gt;&lt;/row&gt;
  &lt;/data&gt;</code></pre>

<p>All the statistics in the output will use the same step. The first sample will be the first sample starting immediately after <b>--start</b>. The last sample will be the one ending at or immediately after <b>--end</b>.</p>

<p>Each sample has a timestamp and one or more values. The timestamps associated with a value in RRDtool ALWAYS represent the time the sample was taken. Since any value you sample will represent some sort of past state your sampling apparatus has gathered, the timestamp will always be at the end of the sampling period.</p>

<p>RRDtool does not store the actual samples, but does internal resampling of the values presented to it. Nevertheless when a data value is presented with a single timestamp the timestamp is at the end of the period the value represents. Note that the timestamp itself is outside the period the sample is valid for. For more details about this, see <a href="./rrd_pdpcalc.html">PDP calculation explanation</a>.</p>

<p>So the time range for a sample with a timestamp is actually from <code>timestamp - step</code> inclusive to <code>timestamp</code> exclusive.</p>

<p>The first line of the sample output:</p>

<pre><code>    &lt;row&gt;&lt;t&gt;1020611700&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;</code></pre>

<p>therefore means that the values for the interval 1020611400 to 1020611699 were 3.4 and 54.4 for &quot;out bytes&quot; and &quot;in and out bits&quot; respectively, because the value was taken at 1020611700.</p>

<h1 id="EXAMPLE-1">EXAMPLE 1</h1>

<pre><code>  rrdtool xport \
          DEF:out=if1-inouts.rrd:outoctets:AVERAGE \
          XPORT:out:&quot;out bytes&quot;</code></pre>

<h1 id="EXAMPLE-2">EXAMPLE 2</h1>

<pre><code>  rrdtool xport \
          DEF:out1=if1-inouts.rrd:outoctets:AVERAGE \
          DEF:out2=if2-inouts.rrd:outoctets:AVERAGE \
          CDEF:sum=out1,out2,+ \
          XPORT:out1:&quot;if1 out bytes&quot; \
          XPORT:out2:&quot;if2 out bytes&quot; \
          XPORT:sum:&quot;output sum&quot;</code></pre>

<h1 id="ENVIRONMENT-VARIABLES">ENVIRONMENT VARIABLES</h1>

<p>The following environment variables may be used to change the behavior of <code>rrdtool&nbsp;xport</code>:</p>

<dl>

<dt id="RRDCACHED_ADDRESS"><b>RRDCACHED_ADDRESS</b></dt>
<dd>

<p>If this environment variable is set it will have the same effect as specifying the <code>--daemon</code> option on the command line. If both are present, the command line argument takes precedence.</p>

</dd>
</dl>

<h1 id="AUTHOR">AUTHOR</h1>

<p>Tobias Oetiker &lt;tobi@oetiker.ch&gt;</p>


</body>

</html>


